package org.xiyu.yee.datl.config;

public class DatlConfig {
    private static DatlConfig instance;
    
    // 旋转相关配置
    private boolean spinEnabled = false;
    private float spinSpeed = 2.0f;
    
    // 连跳相关配置
    private boolean bhopEnabled = false;
    private double bhopAirAcceleration = 0.02; // 空中加速度
    private double bhopMaxSpeed = 1.5; // 最大速度倍数
    private double bhopSpeedDecay = 0.985; // 速度衰减因子
    private double bhopInitialBoost = 1.1; // 初始速度提升倍数
    private double bhopSpeedIncrease = 0.15; // 每次跳跃的速度提升
    
    private DatlConfig() {}
    
    public static DatlConfig getInstance() {
        if (instance == null) {
            instance = new DatlConfig();
        }
        return instance;
    }
    
    // 旋转相关方法
    public boolean isSpinEnabled() {
        return spinEnabled;
    }

    public float getSpinSpeed() {
        return spinSpeed;
    }
    
    public void setSpinSpeed(float spinSpeed) {
        this.spinSpeed = Math.max(0.5f, Math.min(spinSpeed, 100.0f));
    }
    
    public void toggleSpin() {
        this.spinEnabled = !this.spinEnabled;
    }
    
    // 连跳相关方法
    public boolean isBhopEnabled() {
        return bhopEnabled;
    }
    
    public void toggleBhop() {
        this.bhopEnabled = !this.bhopEnabled;
    }
    
    public double getBhopAirAcceleration() {
        return bhopAirAcceleration;
    }
    
    public void setBhopAirAcceleration(double acceleration) {
        this.bhopAirAcceleration = Math.max(0.01, Math.min(acceleration, 0.1));
    }
    
    public double getBhopMaxSpeed() {
        return bhopMaxSpeed;
    }
    
    public void setBhopMaxSpeed(double maxSpeed) {
        this.bhopMaxSpeed = Math.max(1.0, Math.min(maxSpeed, 3.0));
    }
    
    public double getBhopSpeedDecay() {
        return bhopSpeedDecay;
    }
    
    public void setBhopSpeedDecay(double decay) {
        this.bhopSpeedDecay = Math.max(0.9, Math.min(decay, 0.999));
    }
    
    public double getBhopInitialBoost() {
        return bhopInitialBoost;
    }
    
    public void setBhopInitialBoost(double boost) {
        this.bhopInitialBoost = Math.max(1.0, Math.min(boost, 2.0));
    }
    
    public double getBhopSpeedIncrease() {
        return bhopSpeedIncrease;
    }
    
    public void setBhopSpeedIncrease(double increase) {
        this.bhopSpeedIncrease = Math.max(0.05, Math.min(increase, 0.5));
    }
    
    // 连跳设置预设
    public void setBhopPresetBeginner() {
        bhopAirAcceleration = 0.03;
        bhopMaxSpeed = 1.3;
        bhopSpeedDecay = 0.98;
        bhopInitialBoost = 1.15;
        bhopSpeedIncrease = 0.1;
    }
    
    public void setBhopPresetIntermediate() {
        bhopAirAcceleration = 0.02;
        bhopMaxSpeed = 1.5;
        bhopSpeedDecay = 0.985;
        bhopInitialBoost = 1.1;
        bhopSpeedIncrease = 0.15;
    }
    
    public void setBhopPresetExpert() {
        bhopAirAcceleration = 0.015;
        bhopMaxSpeed = 2.0;
        bhopSpeedDecay = 0.99;
        bhopInitialBoost = 1.05;
        bhopSpeedIncrease = 0.2;
    }
    
    public void setBhopPresetInsane() {
        bhopAirAcceleration = 0.025;
        bhopMaxSpeed = 2.5;
        bhopSpeedDecay = 0.995;
        bhopInitialBoost = 1.2;
        bhopSpeedIncrease = 0.25;
    }
}
